﻿using System.Collections.Generic;
using Yuchen.NPA.Core.CompilerService.Method;

namespace Yuchen.NPA.Core
{
    public class MethodDescription
    {
        public MethodDescription()
        {
            Properties = new List<PropertyDescription>();
            //Texts = new List<string>();
            //States = new List<State>();
            Tokens = new List<Token>();
            PropertyOrderBys = new List<PropertyOrderBy>();
        }
        public string Prefix { get; set; }
        public List<PropertyDescription> Properties { get; set; }
        //public State Current { get; set; }
        //public List<string> Texts { get; set; }
        //public List<State> States { get; set; }
        public List<Token> Tokens { get; set; }
        public List<PropertyOrderBy> PropertyOrderBys { get; set; }
    }

    public class Token
    {
        public State Type { get; set; }
        public bool IsCurrent { get; set; }
        public string Text { get; set; }
        public int BeginIndex { get; set; }
    }

    public enum State
    {
        Method,

        /// <summary>
        /// 类似于FindBy，FindListBy的字符串
        /// </summary>
        Prefix,
        PropertyName,
        CalcOperator,
        LogicOperator,

        /// <summary>
        /// 两种操作符都有可能
        /// </summary>
        Operator,
        OrderBy,
        OrderByDirection
    }
}
